package com.hs.room.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.hs.room.model.sys.SysDept
import com.hs.room.model.sys.SysRole
import kotlinx.coroutines.flow.Flow

@Dao
interface SysDeptDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(sysDept: SysDept)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(sysDept: List<SysDept>)

    @Query("SELECT * FROM sys_dept where :code = code")
    suspend fun selectByCode(code:String) : SysDept

    @Update
    fun update(sysDept: SysDept?): Int

    @Update
    fun update(sysDeptList: List<SysDept?>?): Int


    @Query("SELECT * FROM sys_dept")
    fun getAllDeptList(): Flow<List<SysDept>>


}